package com.kele.controller;

import com.kele.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @Version 2019
 * @Author:kele
 * @Date:2021/5/27
 * @Content:
 * @Description：
 */
@Controller
public class HelloController {

    @RequestMapping("/index")
    public String hello(){
        System.out.println("hello收到请求");
        return "index";
    }

    @RequestMapping(value = "/index",method = RequestMethod.POST)
    public String index(@RequestParam("num") Integer id, @RequestParam("str")
            String name){
        System.out.println("接收到了请求,参数是：id="+id+",name="+name);
        //返回逻辑视图
        return "index";
    }

    @RequestMapping("/restful/{num}/{str}")
    public String restful(@PathVariable("num") Integer id,@PathVariable("str")
            String name){
        System.out.println("接收到了请求,参数是：id="+id+",name="+name);
        //返回逻辑视图
        return "index";
    }
    @PostMapping(value = "/add" )
    public String add(User user){
        System.out.println("000000");
        System.out.println(user);
        return "index";

    }

}
